home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM A / PD-ROM A.iso / Programming / Programming Help / Alpha.4.01 / LaTeX / Dewar Macros / dewarLatex
Encoding:
Text File  |  1991-10-17  |  8.0 KB  |  489 lines  |  [TEXT/ALFA]

  1. ;/**********************************************************
  2. ;*                                                         *
  3. ;* Copyright © 1991 Robert L. Dewar.  All rights reserved. *
  4. ;*                                                         *
  5. ;***********************************************************/
  6.  
  7.  
  8. (set sectionExpr "\\(sub)*section{.*}$")
  9. (define setTexMode
  10.     set elecLBrace 0
  11.     set elecRBrace 0
  12.     set electricSemi 0
  13.     set wordWrap 1
  14.     set fillColumn 75
  15.     set paraBegin "(^[ \t]*\r|\r\\.*)"
  16.     set paraEnd "\r([ \t]*$|\\.*)"
  17.     (bind '\79'        nextSection)    ; 'page down'
  18.     (bind '\74'      prevSection)    ; 'page up'
  19.     set leftFillColumn 0)
  20.  
  21. (bind '\12' <o> transposeChars)                ; opt-1
  22. (bind '\13' <o> transposeWords)                ; opt-2
  23. (bind '\2c' <c> gotoLine)                    ; cmd-/
  24. (bind '\53'  setMark)                        ; Keypad 1
  25. (bind '\54'  markHilite)                ; Keypad 2
  26. (bind '\4e'  beginningOfBuffer)    ; Keypad -
  27. (bind '\46' <s> endOfBuffer)        ; Keypad +, Mac Plus
  28. ;(bind '\45'  endOfBuffer)                ; Keypad +, Mac LC
  29.  
  30. (define startMathCtlSeq
  31.     setMark
  32.     type "\\"
  33. )
  34. (bind '\2a' <o> startMathCtlSeq)                ; opt-\
  35.  
  36. (define commentLine        ;need to work out how to comment a selection: ACMD?
  37.     beginningOfLine
  38.     type "% "
  39.     nextLine
  40.     beginningOfLine)
  41. (bind '\47' <c> commentLine)        ; Keypad CMD-Clear
  42.  
  43. (define unCommentLine        ;need to work out how to uncomment a selection:ACMD?
  44.     beginningOfLine
  45.     setMark
  46.     2 forwardChar
  47.     cut
  48.     nextLine
  49.     beginningOfLine)
  50. (bind '\47' <co> unCommentLine)        ; Keypad OPT-CMD-Clear
  51.  
  52. (define backwardSelectWord
  53.     setMark
  54.     backwardWord
  55.     markHilite
  56. )
  57. (bind '\59'  backwardSelectWord)        ; Keypad 7
  58.  
  59. (define backwardExtendSelWd
  60.     backwardWord
  61.     markHilite
  62. )
  63. (bind '\59' <s> backwardExtendSelWd)        ; Shift-Keypad 7
  64.  
  65. (define bkwdSelectCtlSeq
  66.     saveVars                    ; Save variables' values.
  67.     mark "nurke"
  68.     backwardChar
  69.     set regExpr on
  70.     set forward off
  71.     set matchWords off
  72.     search "[ \r\t]"
  73.     forwardChar
  74.     goto "nurke"
  75.     markHilite
  76.     restoreVars                    ; Restore the variables' original values.
  77.     deletemark "nurke"
  78. )
  79. (bind '\52'  bkwdSelectCtlSeq)        ; Keypad 0
  80.  
  81. (define bkwdXtendSelCtlSeq
  82.     saveVars                    ; Save variables' values.
  83.     cut
  84.     mark "fred"
  85.     paste
  86.     mark "nurke"
  87.     goto "fred"
  88.     2 backwardChar
  89.     set regExpr on
  90.     set forward off
  91.     set matchWords off
  92.     search "[ \r\t]"
  93.     forwardChar
  94.     goto "nurke"
  95.     markHilite
  96.     restoreVars                    ; Restore the variables' original values.
  97.     deletemark "fred"
  98.     deletemark "nurke"
  99. )
  100. (bind '\52' <s> bkwdXtendSelCtlSeq)        ; Shift-Keypad 0
  101.  
  102. (define dollarize
  103.     cutclip "fred" ; Use named clipboard to avoid corrupting ordinary
  104. clipboard
  105.     type "$"
  106.     yankclip "fred"
  107.     type "$"
  108. )
  109. (bind '\5b'  dollarize)                ; Keypad 8
  110. (bind '\41'  dollarize)                ; Keypad .
  111.  
  112. (define bracketize
  113.     cutclip "fred"
  114.     type "{"
  115.     yankclip "fred"
  116.     type "}"
  117. )
  118. (bind '\55'  bracketize)                ; Keypad 3
  119.  
  120. (define boldRoman
  121.     cutclip "fred"
  122.     type "{\\bf "
  123.     yankclip "fred"
  124.     type "}"
  125. )
  126. (bind '\0b' <cs> boldRoman)            ; CMD-SHIFT-B
  127.  
  128. (define boldSymbol
  129.     cutclip "fred"
  130.     type "\\mbox{\\boldmath\\( "
  131.     yankclip "fred"
  132.     type "\\)}"
  133. )
  134. (bind '\0b' <cso> boldSymbol)            ; CMD-SHIFT-OPT-B
  135.  
  136. (define italicize
  137.     cutclip "fred"
  138.     type "{\\em "
  139.     yankclip "fred"
  140.     type "}"
  141. )
  142. (bind '\22' <cs> italicize)            ; CMD-SHIFT-I
  143.  
  144. (define calligraphize
  145.     cutclip "fred"
  146.     type "{\\cal "
  147.     yankclip "fred"
  148.     type "}"
  149. )
  150. (bind '\08' <cs>  calligraphize)            ; cmd-shift-c
  151.  
  152. (define blackboardBoldSelection            ; AMS-LaTeX outline font
  153.     cutclip "fred"
  154.     type "{\\Bbb "
  155.     yankclip "fred"
  156.     type "}"
  157. )
  158. (bind '\02' <cs> blackboardBoldSelection)            ; CMD-SHIFT-D
  159.  
  160. (define underline
  161.     cutclip "fred"
  162.     type "\\underline{"
  163.     yankclip "fred"
  164.     type "}"
  165. )
  166. (bind '\20' <cs> underline)            ; CMD-SHIFT-U
  167.  
  168. (define overline
  169.     cutclip "fred"
  170.     type "\\overline{"
  171.     yankclip "fred"
  172.     type "}"
  173. )
  174.  
  175. (define squareRoot
  176.     cutclip "fred"
  177.     type "\\sqrt{"
  178.     yankclip "fred"
  179.     type "}"
  180. )
  181.  
  182. (define    bar
  183.     cutclip "fred"
  184.     type "\\bar{"
  185.     yankclip "fred"
  186.     type "}"
  187. )
  188.  
  189. (define    dot
  190.     cutclip "fred"
  191.     type "\\dot{"
  192.     yankclip "fred"
  193.     type "}"
  194. )
  195.  
  196. (define    doubleDot
  197.     cutclip "fred"
  198.     type "\\ddot{"
  199.     yankclip "fred"
  200.     type "}"
  201. )
  202.  
  203. (define    tilde
  204.     cutclip "fred"
  205.     type "\\tilde{"
  206.     yankclip "fred"
  207.     type "}"
  208. )
  209.  
  210. (define    hat
  211.     cutclip "fred"
  212.     type "\\hat{"
  213.     yankclip "fred"
  214.     type "}"
  215. )
  216.  
  217. (define    invertedHat
  218.     cutclip "fred"
  219.     type "\\breve{"
  220.     yankclip "fred"
  221.     type "}"
  222. )
  223.         
  224. (define barredArrow
  225.     type "\\mapsto"
  226. )
  227.  
  228. (define plusMinus
  229.     type "\\pm"
  230. )
  231.  
  232. (define identicallyEquals
  233.     type "\\equiv"
  234. )
  235.  
  236. (define twoWavyEquals
  237.     type "\\approx"
  238. )
  239.  
  240. (define oneWavyEquals
  241.     type "\\simeq"
  242. )
  243.  
  244. (define lessThanOrEq
  245.     type "\\leq"
  246. )
  247.  
  248. (define greaterThanOrEq
  249.     type "\\geq"
  250. )
  251.  
  252. (define curlyDee
  253.     type "\\partial"
  254. )
  255.  
  256. (define dotsOnLine
  257.     type "\\ldots"
  258. )
  259.  
  260. (define infinity
  261.     type "\\infty"
  262. )
  263.  
  264. (define del
  265.     type "\\nabla"
  266. )
  267.  
  268. (define centredDot
  269.     type "\\cdot"
  270. )
  271.  
  272. (define rightArrow
  273.     type "\\rightarrow"
  274. )
  275.  
  276. (define leftArrow
  277.     type "\\leftarrow"
  278. )
  279.  
  280. (define implies
  281.     type "\\Rightarrow"
  282. )
  283.  
  284. (define cross
  285.     type "\\times"
  286. )
  287.  
  288. (define belongsTo
  289.     type "\\in"
  290. )
  291.  
  292. (define union
  293.     type "\\cup"
  294. )
  295.  
  296. (define intersection
  297.     type "\\cap"
  298. )
  299.  
  300. (define oneEquation
  301.     saveVars
  302.     set indentOnCR off
  303.     type "    \\begin{equation} \\label{eq:xxx}"
  304.     carriageReturn
  305.     type "        yyy \\; punctuation"
  306.     carriageReturn
  307.     type "    \\end{equation}"
  308.     set forward off
  309.     search "xxx"
  310.     restoreVars
  311. )
  312. (bind '\0e' <co>  oneEquation)                ; cmd-option-e
  313.  
  314. (define twoEquations
  315.     saveVars
  316.     set indentOnCR off
  317.     type "    \\begin{eqnarray} \\label{eq:xxx}"
  318.     carriageReturn
  319.     type "        lll & = & rrr"
  320.     carriageReturn
  321.     type "        \\; , \\nonumber \\\\"
  322.     carriageReturn
  323.     type "        lll & = & rrr"
  324.     carriageReturn
  325.     type "        \\; punctuation"
  326.     carriageReturn
  327.     type "    \\end{eqnarray}"
  328.     set forward off
  329.     search "xxx"
  330.     restoreVars
  331. )
  332. (bind '\11' <co>  twoEquations)                ; cmd-option-t
  333.  
  334. (define longEquation
  335.     saveVars
  336.     set indentOnCR off
  337.     type "    \\begin{eqnarray} \\label{eq:xxx}"
  338.     carriageReturn
  339.     type "        lll    & = & rrr\\\\"
  340.     carriageReturn
  341.     type "        \\nonumber \\\\"
  342.     carriageReturn
  343.     type "                &   & \\mbox{} + sss"
  344.     carriageReturn
  345.     type "        \\; punctuation"
  346.     carriageReturn
  347.     type "    \\end{eqnarray}"
  348.     set forward off
  349.     search "xxx"
  350.     restoreVars
  351. )
  352. (bind '\25' <co>  longEquation)                ; cmd-option-l (L)
  353.  
  354. (define intFromTo
  355.     saveVars
  356.     type "\\int_{bot}^{top} xxx \\; dz"
  357.     set forward off
  358.     search "bot"
  359.     restoreVars
  360. )
  361. (bind '\22' <co> intFromTo)                ; cmd-option-i
  362.  
  363. (define prodFromTo
  364.     saveVars
  365.     type "\\prod_{bot}^{top}"
  366.     set forward off
  367.     search "bot"
  368.     restoreVars
  369. )
  370. (bind '\23' <co> prodFromTo)                ; cmd-option-p
  371.  
  372. (define sumFromTo
  373.     saveVars
  374.     type "\\sum_{bot}^{top}"
  375.     set forward off
  376.     search "bot"
  377.     restoreVars
  378. )
  379. (bind '\01' <co> sumFromTo)                ; cmd-option-s
  380.  
  381. (define fractionTmplt
  382.     saveVars
  383.     type "\\frac{top}{bot}"
  384.     set forward off
  385.     search "top"
  386.     restoreVars
  387. )
  388. (bind '\03' <co> fractionTmplt)                ; cmd-option-f
  389.  
  390. (define section
  391.     saveVars
  392.     type "\\section{xxx} \\label{sec:yyy}"
  393.     set forward off
  394.     search "xxx"
  395.     restoreVars
  396. )
  397. (bind '\22' <cso> section)                ; cmd-shift-option-i
  398.  
  399. (define subSection
  400.     saveVars
  401.     type "\\subsection{xxx} \\label{sec:yyy}"
  402.     set forward off
  403.     search "xxx"
  404.     restoreVars
  405. )
  406. (bind '\26' <cso> subSection)                ; cmd-shift-option-j
  407.  
  408. (define defineAMS
  409.     set indentOnCR off
  410.     type "\\input{amssym.def} % Allow use of AMS fonts"
  411.     carriageReturn
  412.     type "\\input{amssym}"
  413.     carriageReturn
  414.     set indentOnCR on
  415. )
  416.  
  417. (menu    LaTeX
  418.     (menu miscSymbols
  419.         "curlyDee"
  420.         "dotsOnLine"
  421.         "infinity"
  422.         "del")
  423.         
  424.     (menu binarySymbols
  425.         "plusMinus"
  426.         "cross"
  427.         "centredDot")
  428.         
  429.     (menu relationSymbols
  430.         "identicallyEquals"
  431.         "twoWavyEquals"
  432.         "oneWavyEquals"
  433.         "lessThanOrEq"
  434.         "greaterThanOrEq"
  435.         "belongsTo"
  436.         "union"
  437.         "intersection")
  438.     
  439.     (menu arrowSymbols
  440.         "implies"
  441.         "barredArrow"
  442.         "rightArrow"
  443.         "leftArrow")
  444.     
  445.     (menu Templates
  446.         "oneEquation"
  447.         "twoEquations"
  448.         "longEquation"
  449.         "intFromTo"
  450.         "prodFromTo"
  451.         "sumFromTo"
  452.         "fractionTmplt"
  453.         "section"
  454.         "subSection")
  455.         
  456.     "(-"
  457.     
  458.     (menu accentSelectedMathChar
  459.         "bar"
  460.         "dot"
  461.         "doubleDot"
  462.         "tilde"
  463.         "hat"
  464.         "invertedHat")
  465.         
  466.     (menu changeSelection
  467.         "boldRoman"
  468.         "boldSymbol"
  469.         "italicize"
  470.         "underline"
  471.         "overline"
  472.         "dollarize"
  473.         "bracketize"
  474.         "calligraphize"
  475.         "squareRoot")
  476.     
  477.     (menu AMSTexFonts
  478.         "defineAMS"
  479.         "blackboardBoldSelection")
  480. )
  481.  
  482. (deleteMenu "Misc")
  483. (deleteMenu "Convert")
  484. (deleteMenu "Wins")
  485. (insertMenu "LaTeX")
  486. (insertMenu "Misc")
  487. (insertMenu "Convert")
  488. (insertMenu "Wins")
  489.